<?php

function confirmsignup($email) {
    //opening connection
    $conn = mysql_connect('localhost', 'root', '') or die(mysql_error());
    mysql_select_db("mydb") or die(mysql_error());
    //email subject 
    $subject = 'Confirmation mail';
    // a query to get memberid 
    $myquery = mysql_query("
         SELECT member_id
         FROM member
         WHERE email = $email") or die(mysql_error());


    // fetching the memberid
    $myrow = mysql_fetch_assoc($myquery);
    // saving the member id in a  variable
    $member_id = $myrow["member_id"];


    // the email message which redirects to the member's homepage  
    $message = <<<EMAIL
    
Please confirm your account through This Link:
http://ayaelmobayad.zapto.org:1234/ConfoDep/main.php?member_id=$member_id}


EMAIL;
    //the email header
    $from = 'info.confo@gmail.com';
    $headers = "From:" . $from;
    mail($email, $subject, $message, $headers);
    // alerting the user that he has to confirm his account 
    echo '<script type="text/javascript">',
    'alert("Please confirm your account through your email");',
    '</script>';
    mysql_close($conn);
}

?>
